
# import os
# import subprocess
# from pathlib import Path
# import nicegui
# cmd = [
#     'python',
#     '-m', 'PyInstaller',
#     'main.py', # your main file with ui.run()
#     '--name', 'myapp', # name of your app
#     '--onefile',
#     #'--windowed', # prevent console appearing, only use with ui.run(native=True, ...)
#     '--add-data', f'{Path(nicegui.__file__).parent}{os.pathsep}nicegui'
# ]
# print(cmd)


# '''
# pyinstaller --noconfirm --onedir --windowed --add-data "D:/python/001MySortWare/网络运维工具/config.py;." --add-data "D:/python/001MySortWare/网络运维工具/initial_set.py;." --add-data "D:/python/001MySortWare/网络运维工具/activetable;activetable/" --add-data "D:/python/001MySortWare/网络运维工具/dfJinja;dfJinja/" --add-data "D:/python/001MySortWare/网络运维工具/public;public/" --add-data "D:/python/001MySortWare/网络运维工具/views;views/" --add-data "D:/python/001MySortWare/网络运维工具/.venv/Lib/site-packages/nicegui;nicegui/"  "D:/python/001MySortWare/网络运维工具/run.py"
# '''


from public import textfsm_run


run_config = [
        {
        "表格名称": "华为设备核对snetconf",
        "设备类型": "华为",
        "输入路径": r"E:\python\learn\lraen_pathlib\input\城域网\BRAS\华为",
        "文件类型": "*.txt;*.log",
        "采集命令": "all",
        "解析模板": "Value snetconf (enable)\nValue netconf (netconf)\n\nStart\n  ^snetconf\\s+server\\s+${snetconf}\n  ^${netconf}",
        "获取设备名称textfsm": "Value DEVICENAME (\\S+)\nValue HOSTNAME (\\S+)\n\nStart\n  ^<${DEVICENAME}>\n  ^sysname\\s+${HOSTNAME}",
        "设备名称分割符": "<device_name>",
    },
    {
        "表格名称": "华为设备核对snetconf2",
        "设备类型": "华为",
        "输入路径": r"E:\python\learn\lraen_pathlib\input\城域网\BRAS\华为",
        "文件类型": "*.txt;*.log",
        "采集命令": "all",
        "解析模板": "Value snetconf (enable)\nValue netconf (netconf)\n\nStart\n  ^snetconf\\s+server\\s+${snetconf}\n  ^${netconf}",
        "获取设备名称textfsm": "Value DEVICENAME (\\S+)\nValue HOSTNAME (\\S+)\n\nStart\n  ^<${DEVICENAME}>\n  ^sysname\\s+${HOSTNAME}",
        "设备名称分割符": "<device_name>",
    },
    {
        "表格名称": "华为设备核对snetconf3",
        "设备类型": "华为",
        "输入路径": r"E:\python\learn\lraen_pathlib\input\城域网\BRAS\华为",
        "文件类型": "*.txt;*.log",
        "采集命令": "all",
        "解析模板": "Value snetconf (enable)\nValue netconf (netconf)\n\nStart\n  ^snetconf\\s+server\\s+${snetconf}\n  ^${netconf}",
        "获取设备名称textfsm": "Value DEVICENAME (\\S+)\nValue HOSTNAME (\\S+)\n\nStart\n  ^<${DEVICENAME}>\n  ^sysname\\s+${HOSTNAME}",
        "设备名称分割符": "<device_name>",
    },
    {
        "表格名称": "华为设备核对snetconf4",
        "设备类型": "华为",
        "输入路径": r"E:\python\learn\lraen_pathlib\input\城域网\BRAS\华为",
        "文件类型": "*.txt;*.log",
        "采集命令": "all",
        "解析模板": "Value snetconf (enable)\nValue netconf (netconf)\n\nStart\n  ^snetconf\\s+server\\s+${snetconf}\n  ^${netconf}",
        "获取设备名称textfsm": "Value DEVICENAME (\\S+)\nValue HOSTNAME (\\S+)\n\nStart\n  ^<${DEVICENAME}>\n  ^sysname\\s+${HOSTNAME}",
        "设备名称分割符": "<device_name>",
    },]

# import cProfile
# cProfile.run('textfsm_run_copy.run_joblib(run_config)')
# import time
# startime=time.time()
# bb=textfsm_run.run_joblib(run_config)
# # print(bb)
# print('run_joblib 耗时:',time.time()-startime)

# startime=time.time()
# bb=textfsm_run_copy.run(run_config)
# # print(bb)
# print('普通耗时:',time.time()-startime)

from joblib import Parallel, delayed
p=Parallel(n_jobs=-1)
print(p,type(p))